package procilege.impl.formatter;

import procilege.compute.ExprFormatTraveller;
import procilege.compute.PlaceTypeMetadata;
import procilege.compute.PlaceType;
import procilege.lang.PredicateValue;

@PlaceTypeMetadata(type = PredicateValue.class)
public class PredicateValueFormatter implements PlaceType<ExprFormatTraveller> {

	public void visit(ExprFormatTraveller tr, Object place) {

		StringBuilder sb = tr.getBuilder();
		
		Object value = ((PredicateValue) place).getValue();
		
		if (value instanceof String) {
			sb.append('\"');
			sb.append(value.toString());
			sb.append('\"');
		} else
			sb.append(value.toString());
	}
}